import request from '@/utils/request'

// 封装角色数据API
export function getRoleListAPI(params) {
  return request({
    method: 'get',
    url: '/sys/role',
    params
  })
}
// 删除
export function deleteRoleAPI(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

// 新增角色
export function addRoleAPI(data) {
  return request({
    url: `/sys/role`,
    method: 'POST',
    data
  })
}

// 封装 数据回填API
export function getRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

// 封装编辑api
export function updateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    data,
    method: 'put'
  })
}

export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
